//
//  UILabel+UILable.m
//  ArtHouse
//
//  Created by Arthoo on 15/5/28.
//  Copyright (c) 2015年 arthouse. All rights reserved.
//

#import "UILabel+UILable.h"

@implementation UILabel (UILable)

+(UILabel *)lableWithText:(CGRect)cgrect Color:(UIColor *)color Text:(NSString *)text Font:(UIFont *)font
{
    UILabel *lab = [[UILabel alloc]initWithFrame:cgrect];
    lab.textColor = color;
    lab.text = text;
    lab.font = font;
    return lab;
}

- (CGSize)boundingRectWithSize:(CGSize)size
{
    NSDictionary *attribute = @{NSFontAttributeName: self.font};
    
    CGSize retSize = [self.text boundingRectWithSize:size
                                             options:\
                      NSStringDrawingTruncatesLastVisibleLine |
                      NSStringDrawingUsesLineFragmentOrigin |
                      NSStringDrawingUsesFontLeading
                                          attributes:attribute
                                             context:nil].size;
    
    return retSize;
}

@end
